from flask import Flask, render_template, redirect, url_for, request, flash
from flask_sqlalchemy import SQLAlchemy
import click
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, TextAreaField
from wtforms.validators import DataRequired, Length
from .models import *
from .extensions import db, login_manager
import os
from .forms import *
from flask_login import login_user
from notes_ms import app, db


@app.cli.command()
def initdb():
    """删除数据库文件，并且重新建立数据文件

    """
    db.drop_all()
    db.create_all()
    click.echo("database init ok 数据库重新建立成功")


@app.shell_context_processor
def make_shell_content():
    """flask shell 上下文
    """
    return dict(db=db, Note=Note, Admin=Admin)